package javaLanguage.base;


interface print{
    public void printHolloWorld();
}

class sayHello implements print{
    @Override
    public void printHolloWorld() {
        System.out.printf("hello World!\n");
    }
}

class DecoratorCore implements print{
    private print temp;
    DecoratorCore(print a) {
        this.temp = a;
    }
    @Override
    public void printHolloWorld() {
        temp.printHolloWorld();
    }
}

public class decorator extends DecoratorCore{
    public decorator(print a){
        super(a);
    }
    @Override
    public void printHolloWorld() {
        System.out.printf("asdfasdfa\n");
        super.printHolloWorld();
    }

    public static void main(String[] args) {
        decorator a = new decorator(new sayHello());
        a.printHolloWorld();
    }
}
